﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace asp_mysql
{
    public partial class Formulario_web12 : System.Web.UI.Page
    {
        string tipo1, tipo2;
        conexion conectar = new conexion();

        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList1.SelectedItem.ToString();
            DropDownList2.SelectedItem.ToString();
            TextBox1.ToString();
            TextBox2.ToString();
            TextBox3.ToString();
            TextBox4.ToString();
            TextBox5.ToString();
            TextBox6.ToString();
            TextBox7.ToString();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //Alta
            conectar.abrir();

            if (conectar.grabar("insert into alumno (nombre_alum,appat_alum,apmat_alum,sex_alum,tel_alum,est_alum,gra_alum) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + tipo1 + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + tipo2 + "'); insert into cuenta (usu_cuen,pass_cuen,tipo_cuen,iden_cuen) values ('" + TextBox6.Text + "','" + TextBox7.Text + "','  3  ','" + TextBox4.Text + "'"))
            {
                conectar.cerrar();
            }

            conectar.cerrar();
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            tipo1 = DropDownList1.SelectedItem.ToString();
        }

        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            tipo2 = DropDownList2.SelectedItem.ToString();
        }
    }
}